/**
 * Created by Francis.LW on 2017/10/20.
 *
 * 表单项服务接口
 */
import {postRequest, getRequest} from '@/common/request'
import {urls} from './url'

const formTemplateApi = urls.formTemplate


function listFormTemplate(param, page, pageSize, success, complete) {
  postRequest(formTemplateApi.listFormTemplate + '?currentpage=' + page + '&pagesize=' + pageSize, {}, param, success, complete)
}

function addFormTemplate(param, success, complete) {
  postRequest(formTemplateApi.addFormTemplate, {}, param, success, complete)
}

function updateFormTemplate(id, param, success, complete) {
  postRequest(formTemplateApi.updateFormTemplate + id, {}, param, success, complete)
}

function getFormTemplate(id, success, complete) {
  getRequest(formTemplateApi.getFormTemplate + id, {}, success, complete)
}

function removeFormTemplate(ids, success, complete) {
  postRequest(formTemplateApi.removeFormTemplate, {}, ids, success, complete)
}

function deleteSingleFormTemplate(id, success, complete) {
  let ids = []
  ids.push(id)
  removeFormTemplate(ids, success, complete)
}

export default {
  listFormTemplate,
  addFormTemplate,
  updateFormTemplate,
  getFormTemplate,
  removeFormTemplate,
  deleteSingleFormTemplate
}
